﻿<%@ Page Language="C#" MasterPageFile="~/Shared/Masters/List.master" AutoEventWireup="true"
    CodeFile="FlowList.aspx.cs" Inherits="Modules_Flow_FlowList" Title="流程列表" Theme="Default" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register TagPrefix="web" TagName="listtitle" Src="~/Shared/UserControls/ListTitle.ascx" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<%@ Register Assembly="YYControls" Namespace="YYControls" TagPrefix="yyc" %>
<asp:Content ContentPlaceHolderID="idList" ID="idListContent" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <contenttemplate>
    <div class="crumb">
        <asp:Label runat="server" ID="lblTitle" Text="流程管理"></asp:Label>
    </div>
    <div id="divFlow" runat="server">
        <div class="search" id="search">
            <table cellpadding="2" cellspacing="0" class="rtm_shb_b">
                <tr>
                    <td style="width: 100px;">
                        <asp:Label runat="server" ID="lblCode" Text="编号:"></asp:Label>
                        <asp:TextBox ID="txtCode" runat="server" Width="200px"></asp:TextBox>
                    </td>
                    <td style="width: 100px;">
                        <asp:Label runat="server" ID="lblName" Text="流程名称:"></asp:Label>
                        <asp:TextBox ID="txtName" runat="server" Width="200px"></asp:TextBox>
                    </td>
                    <td class="rtm_shb_btn" style="white-space: nowrap">
                        <asp:Button ID="btnSearch" runat="server" Text="查询" OnClick="btnSearch_Click"></asp:Button>&nbsp;
                        <asp:Button ID="ResetLinkButton" runat="server" Text="重置" OnClientClick="reset();return false;">
                        </asp:Button>
                    </td>
                </tr>
            </table>
        </div>
        <div class="toolbar" id="toolbar">
            <h2>
                <web:listtitle ID="Listtitle1" runat="server" Title="流程信息" />
            </h2>
            <asp:LinkButton ID="btnCreate" runat="server" OnClientClick="return openEditor(this, 'add');"
                Visible="false">
                <asp:Label ID="lblCreatNew" runat="server" Text="">
                    <img runat="server" id="imgNew" src="../../Images/icon_new.gif" style="border: 0px" />新建</asp:Label>
            </asp:LinkButton>
        </div>
        <yyc:SmartGridView ID="gvFlowList" runat="server" AutoGenerateColumns="False" AllowSorting="True"
            OnSorting="gvFlowList_Sorting" OnRowCommand="gvFlowList_RowCommand" OnRowDataBound="gvFlowList_RowDataBound"
            EmptyDataText="没有找到数据!">
         
            <Columns>
                <asp:TemplateField HeaderText="操作">
                    <itemtemplate>
                  <table width="46px" style="text-align: left">                    
                        <tr>
                            <td style="border: 0px solid #fff;">
                                <asp:ImageButton runat="server" CommandName="reload" CausesValidation="False" OnClientClick="return openEditor(this, 'read');" Visible="false"
                                 ImageUrl="~/Images/icon_srh.gif" ToolTip="查看"  _ID='<%#Eval("ID")%>' ID="ibtnSelect" ></asp:ImageButton>
</td>
                          <td style="border: 0px solid #fff;">
                                <asp:ImageButton runat="server" CommandName="step" CausesValidation="False" 
                                 ImageUrl="~/Images/icon_srh.gif" ToolTip="步骤管理" CommandArgument='<%# Eval("ID") %>'  ID="ibtnStep" ></asp:ImageButton>
</td>
  <td style="border: 0px solid #fff;">
                                <asp:ImageButton runat="server" CommandName="del" CommandArgument='<%# Eval("ID") %>' Visible="false" CausesValidation="False"  OnClientClick="return sureDelete();" ImageUrl="~/Images/com/dg_del.gif" ToolTip="删除" ID="ibtnDelete" meta:resourcekey="ibtnDeleteResource1"></asp:ImageButton>
</td>
</tr>
</table>
                       
</itemtemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="Code" HeaderText="编号" SortExpression="Code" />
                <asp:BoundField DataField="Name" HeaderText="名称" SortExpression="Name" />
                <asp:BoundField DataField="Remark" HeaderText="备注" />
            </Columns>
        </yyc:SmartGridView>
        <webdiyer:AspNetPager ID="AspNetPager" CssClass="aspNetPager" ShowBoxThreshold="1"
            runat="server" HorizontalAlign="Right" PageSize="20" AlwaysShow="True" FirstPageText="首页"
            LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页" Width="98%" CustomInfoClass="aspNetPager"
            LayoutType="Div" PageIndexBoxType="TextBox" ShowPageIndexBox="Auto">
        </webdiyer:AspNetPager>
    </div>
    </contenttemplate> </asp:UpdatePanel>
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <contenttemplate>
      
      <div id="divStep" runat="server" style="display:none;">
      
       <div class="search" id="divStepSearch">
        <table cellpadding="2" cellspacing="0" class="rtm_shb_b">
            <tr>
               
                <td style="width: 100px;">
                    <asp:Label runat="server" ID="lblStepName" Text="步骤名称:"></asp:Label>
                    <asp:TextBox ID="txtStepName" runat="server" Width="200px"></asp:TextBox>
                </td>
                <td class="rtm_shb_btn" style="white-space: nowrap">
                    <asp:Button ID="btnStepSearch" runat="server" Text="查询" OnClick="btnStepSearch_Click"></asp:Button>&nbsp;
                    <asp:Button ID="ReseSteptLinkButton" runat="server" Text="重置" OnClientClick="reset();return false;">
                    </asp:Button>
                </td>
            </tr>
        </table>
    </div>
      
    <div class="toolbar" id="divFlowTitle" runat="server" >
        <h2>
            <web:listtitle ID="Listtitle2" runat="server" Title="流程管理" />
            ---<asp:Label ID="lblFlowStep" runat="server" Text="流程步骤管理"></asp:Label>
        </h2>
       
       <asp:HiddenField Id="hidFlowID" runat="server" ></asp:HiddenField>
        <asp:LinkButton ID="btnCreateStep" runat="server" OnClientClick="return openEditorStep(this, 'add');" 
            OnClick="btnCreateStep_Click">
            <asp:Label ID="lblCreatNewStep" runat="server" Text="">
                &nbsp;&nbsp;新建</asp:Label>
        </asp:LinkButton>
        
         <asp:LinkButton ID="lbtnBack" runat="server" OnClick="LBtnBack_Click">
            <asp:Label ID="Label1" runat="server" Text="">
                &nbsp;&nbsp;返回</asp:Label>
        </asp:LinkButton>&nbsp;
    </div>
    <yyc:SmartGridView ID="gvStepList" runat="server" AutoGenerateColumns="False" AllowSorting="True"
        OnSorting="gvStepList_Sorting" OnRowCommand="gvStepList_RowCommand" OnRowDataBound="gvStepList_RowDataBound"
        EmptyDataText="没有找到数据!">
        <FixRowColumn FixRowType="Header,Pager" FixColumns="0,1"></FixRowColumn>
        <Columns>
            <asp:TemplateField HeaderText="操作">
                <itemtemplate>
                            <table width="46px" style="text-align: left">                    
                                <tr>
                                    <td style="border: 0px solid #fff;">
                                        <asp:ImageButton runat="server" CommandName="edt" CausesValidation="False" ImageUrl="~/Images/icon_edit.gif" ToolTip="查看"
                                          _StepID='<%#Eval("Id")%>' _FlowID='<%# Eval("Flow_ID")%>' OnClientClick="return openEditorStep(this, 'edit');" ID="ibtnEdit"></asp:ImageButton>
                                    </td>
                                    <td style="border: 0px solid #fff;">
                                        <asp:ImageButton runat="server" CommandName="del" CommandArgument='<%# Eval("ID") %>' CausesValidation="False"  
                                        OnClientClick="return sureDelete();" ImageUrl="~/Images/com/dg_del.gif" ToolTip="删除" ID="ibtnDeletes" ></asp:ImageButton>
                                    </td>
                                </tr>
                            </table>
        </itemtemplate>
                <controlstyle forecolor="Black" />
                <headerstyle wrap="False" horizontalalign="Center" />
                <itemstyle horizontalalign="Center" forecolor="Black" />
            </asp:TemplateField>
             <asp:TemplateField   HeaderText= "步骤 "> 
<ItemTemplate> 
<asp:Label runat="server" Text='<%# Container.DataItemIndex+1%>'  CssClass="text_overflow"  ID="lblNO"></asp:Label>
</ItemTemplate> 
</asp:TemplateField> 
             <asp:BoundField DataField="StepName" HeaderText="步骤名称" SortExpression="StepName" />
           <%-- <asp:BoundField DataField="Approve_Way" HeaderText="审批方式" SortExpression="Approve_Way" />--%>
            
              <asp:TemplateField HeaderText="审批方式" SortExpression="Approve_Way" >
                <ItemTemplate>
                <asp:Label runat="server" Text='<%# Eval("Approve_Way").ToString()=="0"?"角色":Eval("Approve_Way").ToString()=="1"?"部门":"用户" %>' 
                CssClass="text_overflow"  ID="lblApproveWay"></asp:Label>
                </ItemTemplate>
                <headerstyle wrap="False" />
            </asp:TemplateField>
            
              <asp:TemplateField HeaderText="审批人"  >
                <ItemTemplate>
                <asp:Label runat="server" Text='<%# GetRole(Eval("ID")) %>' CssClass="text_overflow"  ID="lblBlock"></asp:Label>
                </ItemTemplate>
                <headerstyle wrap="False" />
            </asp:TemplateField>
            
            <asp:BoundField DataField="Remark" HeaderText="备注" SortExpression="Remark" />
        </Columns>
        <FixRowColumn FixRowType="Header,Pager" FixColumns="0" />
    </yyc:SmartGridView>
    <webdiyer:AspNetPager ID="AspNetPager1" CssClass="aspNetPager" ShowBoxThreshold="1"
         runat="server" HorizontalAlign="Right" PageSize="20" AlwaysShow="True"
        FirstPageText="首页" OnPageChanged="AspNetPager1_PageChanged" LastPageText="尾页"
        NextPageText="下一页" PrevPageText="上一页" Width="98%" CustomInfoClass="aspNetPager"
        LayoutType="Div" PageIndexBoxType="TextBox" ShowPageIndexBox="Auto">
    </webdiyer:AspNetPager>
    </div>
     </contenttemplate>
    </asp:UpdatePanel>

    <script type="text/javascript">
        function openEditor(_this, action) {
        
       
            var url = "FlowAdd.aspx";
            return default_openEditor(url, _this, action, 480, 240,true);
        } 
        
        function sureDelete()
        {
             return confirm("您确认要删除吗?");        
        }
        
          function openEditorStep(_this, action) {
          
        var flowID=document.getElementById("ctl00_idList_hidFlowID").value;       
            var url = "FlowStepAdd.aspx?FlowID="+flowID;
            return default_openEditor(url, _this, action, 480, 240,true);
        } 
        
       
        
        
    </script>

</asp:Content>
